package org.jeecg.modules.tea_stu_course.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.checkerframework.checker.units.qual.A;
import org.jeecg.common.system.base.entity.SysUserTit;
import org.jeecg.modules.course.entity.AstuCourse;
import org.jeecg.modules.course.mapper.AstuCourseMapper;
import org.jeecg.modules.student.entity.AstuInformation;
import org.jeecg.modules.student.mapper.AstuInformationMapper;
import org.jeecg.modules.tea_stu_course.entity.AstuTeastuCourse;
import org.jeecg.modules.tea_stu_course.mapper.AstuTeastuCourseMapper;
import org.jeecg.modules.tea_stu_course.service.IAstuTeastuCourseService;
import org.jeecg.modules.teacher.entity.AstuTeacher;
import org.jeecg.modules.teacher.mapper.AstuTeacherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 老师学生课程交汇表
 * @Author: jeecg-boot
 * @Date:   2021-10-12
 * @Version: V1.0
 */
@Service
public class AstuTeastuCourseServiceImpl extends ServiceImpl<AstuTeastuCourseMapper, AstuTeastuCourse> implements IAstuTeastuCourseService {

    @Resource
    private AstuTeastuCourseMapper astuTeastuCourseMapper;
    @Resource
    private AstuTeacherMapper astuTeachermapper;
    @Resource
    private AstuInformationMapper astuInformationMapper;
    @Resource
    private AstuCourseMapper astuCourseMapper;

    @Override
    public SysUserTit selectUser(String username) {
        return astuTeastuCourseMapper.selectUser(username);
    }

    @Override
    public AstuTeastuCourse selectAstuTeastuCourseByStudentNumberAndteacherNumberAndCourseId(String studentNumber, String teacherNumber, String courseId) {
        return astuTeastuCourseMapper.selectAstuTeastuCourseByStudentNumberAndteacherNumberAndCourseId(studentNumber, teacherNumber, courseId);
    }

    @Override
    public AstuTeacher selectByTeaNum(String teacherNumber) {
        LambdaQueryWrapper <AstuTeacher>wrapper = new LambdaQueryWrapper();
        wrapper.eq(AstuTeacher::getTeacherNumber,teacherNumber);
        AstuTeacher astuTeacher = astuTeachermapper.selectOne(wrapper);
        return astuTeacher;
    }

    @Override
    public AstuInformation selectByStuNum(String studentNumber) {
        LambdaQueryWrapper<AstuInformation> QueryWrapper = new LambdaQueryWrapper<>();
        QueryWrapper.eq(AstuInformation::getStuNumber,studentNumber);
        AstuInformation astuStudent = astuInformationMapper.selectOne(QueryWrapper);
        return astuStudent;
    }

    @Override
    public AstuCourse selectByCourseNum(String courseId) {
        LambdaQueryWrapper<AstuCourse> QueryWrapper = new LambdaQueryWrapper<>();
        QueryWrapper.eq(AstuCourse::getCourseNumber,courseId);
        AstuCourse course = astuCourseMapper.selectOne(QueryWrapper);
        return course;
    }

    @Override
    public List<AstuTeastuCourse> selectInfoByNum(String studentNumber) {
        return astuTeastuCourseMapper.selectInfoByNum(studentNumber);
    }

    @Override
    public AstuTeastuCourse selectinfoByStuNumAndCourseNum(String studentNumber, String courseNumber) {
        return astuTeastuCourseMapper.selectinfoByStuNumAndCourseNum(studentNumber, courseNumber);
    }
}
